//    Copyright (C) 2013  <lugocreation@gmail.com>
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>
package org.jpgolay.wi.propertie;

import java.awt.Color;
import java.awt.Container;
import java.util.ResourceBundle;
import javax.swing.*;
import org.netbeans.lib.awtextra.AbsoluteConstraints;
import org.netbeans.lib.awtextra.AbsoluteLayout;

public class PropertyGUI extends JFrame {

    public PropertyGUI() {
        initComponents();
        setIconImage((new ImageIcon(getClass().getResource("/org/jpgolay/wi/images/logo.gif"))).getImage());
    }

    private void initComponents() {
        buttonGroup1 = new ButtonGroup();
        mainP = new JPanel();
        mainFieldsP = new JPanel();
        serialL = new JLabel();
        serial = new JTextField();
        ipL = new JLabel();
        ip = new JTextField();
        dbHomeL = new JLabel();
        dbHome = new JTextField();
        dbBackupL = new JLabel();
        dbBackup = new JTextField();
        adminUserL = new JLabel();
        adminUser = new JTextField();
        adminPassL = new JLabel();
        adminPass = new JTextField();
        adminUrlL = new JLabel();
        adminUrl = new JTextField();
        wiUserL = new JLabel();
        wiUser = new JTextField();
        wiPassL = new JLabel();
        wiPass = new JTextField();
        wiUrlL = new JLabel();
        wiUrl = new JTextField();
        dbDriverL = new JLabel();
        dbDriver = new JTextField();
        dbNewL = new JLabel();
        dbRemoveL = new JLabel();
        dbNew = new JCheckBox();
        dbRemove = new JCheckBox();
        actionP = new JPanel();
        okB = new JButton();
        cancelB = new JButton();
        setTitle(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("welcome_title"));
        mainFieldsP.setLayout(new AbsoluteLayout());
        serialL.setText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("SN"));
        mainFieldsP.add(serialL, new AbsoluteConstraints(0, 0, 150, 20));
        serial.setHorizontalAlignment(0);
        serial.setToolTipText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("serial_number"));
        mainFieldsP.add(serial, new AbsoluteConstraints(150, 0, 300, 20));
        ipL.setText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("IP_server"));
        mainFieldsP.add(ipL, new AbsoluteConstraints(0, 20, 150, 20));
        ip.setHorizontalAlignment(0);
        ip.setToolTipText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("ip_address"));
        mainFieldsP.add(ip, new AbsoluteConstraints(150, 20, 300, 20));
        dbHomeL.setText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("DB_Home"));
        mainFieldsP.add(dbHomeL, new AbsoluteConstraints(0, 40, 150, 20));
        dbHome.setToolTipText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("data_directory_(for_backup_process)"));
        mainFieldsP.add(dbHome, new AbsoluteConstraints(150, 40, 300, 20));
        dbBackupL.setText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("DB_Backup"));
        mainFieldsP.add(dbBackupL, new AbsoluteConstraints(0, 60, 150, 20));
        dbBackup.setToolTipText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("backup_directory"));
        mainFieldsP.add(dbBackup, new AbsoluteConstraints(150, 60, 300, 20));
        adminUserL.setForeground(new Color(204, 0, 51));
        adminUserL.setText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("DB_user_admin"));
        mainFieldsP.add(adminUserL, new AbsoluteConstraints(0, 80, 150, 20));
        adminUser.setForeground(new Color(204, 0, 51));
        adminUser.setToolTipText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("used_for_install"));
        mainFieldsP.add(adminUser, new AbsoluteConstraints(150, 80, 300, 20));
        adminPassL.setForeground(new Color(204, 0, 51));
        adminPassL.setText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("DB_pass_admin"));
        mainFieldsP.add(adminPassL, new AbsoluteConstraints(0, 100, 150, 20));
        adminPass.setForeground(new Color(204, 0, 51));
        adminPass.setToolTipText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("used_for_install"));
        mainFieldsP.add(adminPass, new AbsoluteConstraints(150, 100, 300, 20));
        adminUrlL.setForeground(new Color(204, 0, 51));
        adminUrlL.setText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("DB_url_admin"));
        mainFieldsP.add(adminUrlL, new AbsoluteConstraints(0, 120, 150, 20));
        adminUrl.setForeground(new Color(204, 0, 51));
        adminUrl.setToolTipText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("used_for_install"));
        mainFieldsP.add(adminUrl, new AbsoluteConstraints(150, 120, 300, 20));
        wiUserL.setForeground(new Color(0, 51, 204));
        wiUserL.setText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("DB_user_wi"));
        mainFieldsP.add(wiUserL, new AbsoluteConstraints(0, 140, 150, 20));
        wiUser.setForeground(new Color(0, 51, 204));
        wiUser.setToolTipText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("username_for_webimmo"));
        mainFieldsP.add(wiUser, new AbsoluteConstraints(150, 140, 300, 20));
        wiPassL.setForeground(new Color(0, 51, 204));
        wiPassL.setText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("DB_pass_wi"));
        mainFieldsP.add(wiPassL, new AbsoluteConstraints(0, 160, 150, 20));
        wiPass.setForeground(new Color(0, 51, 204));
        wiPass.setToolTipText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("password_for_webimmo"));
        mainFieldsP.add(wiPass, new AbsoluteConstraints(150, 160, 300, 20));
        wiUrlL.setForeground(new Color(0, 51, 204));
        wiUrlL.setText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("DB_url_wi"));
        mainFieldsP.add(wiUrlL, new AbsoluteConstraints(0, 180, 150, 20));
        wiUrl.setForeground(new Color(0, 51, 204));
        wiUrl.setToolTipText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("url_for_mysql_server"));
        mainFieldsP.add(wiUrl, new AbsoluteConstraints(150, 180, 300, 20));
        dbDriverL.setForeground(new Color(51, 102, 0));
        dbDriverL.setText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("DB_driver"));
        mainFieldsP.add(dbDriverL, new AbsoluteConstraints(0, 200, 150, 20));
        dbDriver.setForeground(new Color(51, 102, 0));
        dbDriver.setToolTipText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("JDBC_driver"));
        mainFieldsP.add(dbDriver, new AbsoluteConstraints(150, 200, 300, 20));
        dbNewL.setText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("DB_install"));
        mainFieldsP.add(dbNewL, new AbsoluteConstraints(0, 220, 150, 20));
        dbRemoveL.setText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("DB_remove"));
        mainFieldsP.add(dbRemoveL, new AbsoluteConstraints(0, 240, 150, 20));
        dbNew.setText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("WARNING_Just_for_first_installation_!"));
        dbNew.setToolTipText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("Do_not_use_!_Ask_your_administrator_before"));
        buttonGroup1.add(dbNew);
        mainFieldsP.add(dbNew, new AbsoluteConstraints(150, 220, 300, 23));
        dbRemove.setText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("WARNING_All_data_will_lost_!"));
        dbRemove.setToolTipText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("Do_not_use_!___Ask_your_administrator_before"));
        buttonGroup1.add(dbRemove);
        mainFieldsP.add(dbRemove, new AbsoluteConstraints(150, 240, 300, 20));
        mainP.add(mainFieldsP);
        getContentPane().add(mainP, "Center");
        okB.setText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("OK"));
        actionP.add(okB);
        cancelB.setText(ResourceBundle.getBundle("org/jpgolay/wi/wii").getString("CANCEL"));
        actionP.add(cancelB);
        getContentPane().add(actionP, "South");
        pack();
    }

    public String getAdminPass() {
        return adminPass.getText();
    }

    public String getAdminUrl() {
        return adminUrl.getText();
    }

    public String getAdminUser() {
        return adminUser.getText();
    }

    public JButton getCancelB() {
        return cancelB;
    }

    public String getDbBackup() {
        return dbBackup.getText();
    }

    public String getDbDriver() {
        return dbDriver.getText();
    }

    public String getDbHome() {
        return dbHome.getText();
    }

    public boolean isDbNew() {
        return dbNew.isSelected();
    }

    public boolean isDbRemove() {
        return dbRemove.isSelected();
    }

    public String getIp() {
        return ip.getText();
    }

    public JButton getOkB() {
        return okB;
    }

    public String getSerial() {
        return serial.getText();
    }

    public String getWiPass() {
        return wiPass.getText();
    }

    public String getWiUrl() {
        return wiUrl.getText();
    }

    public String getWiUser() {
        return wiUser.getText();
    }

    public void setAdminPass(String field) {
        adminPass.setText(field);
    }

    public void setAdminUrl(String field) {
        adminUrl.setText(field);
    }

    public void setAdminUser(String field) {
        adminUser.setText(field);
    }

    public void setDbBackup(String field) {
        dbBackup.setText(field);
    }

    public void setDbDriver(String field) {
        dbDriver.setText(field);
    }

    public void setDbHome(String field) {
        dbHome.setText(field);
    }

    public void setIp(String field) {
        ip.setText(field);
    }

    public void setSerial(String field) {
        serial.setText(field);
    }

    public void setWiPass(String field) {
        wiPass.setText(field);
    }

    public void setWiUrl(String field) {
        wiUrl.setText(field);
    }

    public void setWiUser(String field) {
        wiUser.setText(field);
    }
    private JPanel actionP;
    private JTextField adminPass;
    private JLabel adminPassL;
    private JTextField adminUrl;
    private JLabel adminUrlL;
    private JTextField adminUser;
    private JLabel adminUserL;
    private ButtonGroup buttonGroup1;
    private JButton cancelB;
    private JTextField dbBackup;
    private JLabel dbBackupL;
    private JTextField dbDriver;
    private JLabel dbDriverL;
    private JTextField dbHome;
    private JLabel dbHomeL;
    private JCheckBox dbNew;
    private JLabel dbNewL;
    private JCheckBox dbRemove;
    private JLabel dbRemoveL;
    private JTextField ip;
    private JLabel ipL;
    private JPanel mainFieldsP;
    private JPanel mainP;
    private JButton okB;
    private JTextField serial;
    private JLabel serialL;
    private JTextField wiPass;
    private JLabel wiPassL;
    private JTextField wiUrl;
    private JLabel wiUrlL;
    private JTextField wiUser;
    private JLabel wiUserL;
}
